﻿using InnoWeb.CEND.BL.Infrastructure;
using InnoWeb.CEND.Core.Model.Videos;
using InnoWeb.CEND.Data;
using InnoWeb.CEND.Data.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace InnoWeb.CEND.BL.Service.Videos
{
    public class VideoContentService : IService<VideoContents>
    {
        private readonly GenericRepository<VideoContents> _videoContentRepository;
        private readonly IUnitOfWork _unitOfWork;

        public VideoContentService(IUnitOfWork unitOfWork, GenericRepository<VideoContents> expertRepository)
        {
            this._videoContentRepository = expertRepository;
            this._unitOfWork = unitOfWork;
        }

        //public async Task<IQueryable<ExpertInfo>> GetAllElements()
        //{
        //    IQueryable<ExpertInfo> returnList = await _expertRepository.GetAll();
        //}

        public IQueryable<VideoContents> GetAllElements()
        {
            return _videoContentRepository.GetAll();
        }

        public VideoContents GetElementById(int id)
        {
            return _videoContentRepository.GetById(id);
        }

        public void CreateElement(VideoContents entity)
        {
            _videoContentRepository.Insert(entity);
        }

        public void UpdateElement(VideoContents entity)
        {
            _videoContentRepository.Update(entity);
        }

        public void DeleteElement(int id)
        {
            _videoContentRepository.Delete(id);
        }

        public void SaveChanges()
        {
            _unitOfWork.SaveChanges();
        }
    }
}
